$(document).ready(
	function() {
		var change = true;
		var current;
		var next = function(){
						if(window.location.hash.length != 0){
							current.hide();
							current=current.parent().parent().next().find('a.ca-more');
							window.location.hash=current.attr('id');
						}
		};
		
		var prev = function(){
						if(window.location.hash.length != 0){
							current.hide();
							current=current.parent().parent().prev().find('a.ca-more');
							window.location.hash=current.attr('id');
						}
		};
		
		$('#ca-container').bind('mousewheel', function(e, delta) {
			
			if(change){
				change=false;
				if(delta > 0) {
					
					prev();
					
					
				}	
				else {
					
					next();
					
				}	
				setTimeout(function(){change=true;},500);
			}
		});
		
		$('.ca-close').click(
			function(){
					var stateObj = { foo: "index" };
					history.pushState(stateObj, "SWTUNIS-INSAT", "index.html");
			}
		);
		
		$('.ca-nav-next').click(
			next
		);
		
		$('.ca-nav-prev').click(
			prev
		);
		
		$('a.ca-more').click(
			function(){
				current=$(this);
				window.location.hash=current.attr('id');
				
			}
		);
		if(window.location.hash.length != 0){
		current=$(window.location.hash);
		current.trigger('click');
		}
  
	}
);